
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE [dbo].gspFAQItem_SEARCH
(
@faqItemId int = null,
@question nvarchar(4000) = null,
@answer nvarchar(4000) = null,
@orderNumber int = null,
@isDeleted bit = null,
@createDate datetime = null,
@lastModifiedDate datetime = null
)
AS

SELECT
  *
FROM
  [dbo].[FAQItem]
WHERE
  (@faqItemId IS NULL OR [FaqItemId] = @faqItemId)
AND
  (@question IS NULL OR @question = '' OR [Question] LIKE @question + '%')
AND
  (@answer IS NULL OR @answer = '' OR [Answer] LIKE @answer + '%')
AND
  (@orderNumber IS NULL OR [OrderNumber] = @orderNumber)
AND
  (@isDeleted IS NULL OR [IsDeleted] = @isDeleted)
AND
  (@createDate IS NULL OR [CreateDate] = @createDate)
AND
  (@lastModifiedDate IS NULL OR [LastModifiedDate] = @lastModifiedDate)

GO
